SpatialDropoutType< InputType, OutputType > Class Template Reference

Implementation of the SpatialDropout layer. More...

Inheritance diagram for SpatialDropoutType< InputType, OutputType >:

Public Member Functions

 SpatialDropoutType ()
 Create the SpatialDropout object. More...

 
 SpatialDropoutType (const size_t size, const double ratio=0.5)
 Create the SpatialDropout object using the specified parameters. More...

 
void Backward (const InputType &input, const OutputType &gy, OutputType &g)
 Ordinary feed backward pass of the SpatialDropout layer. More...

 
SpatialDropoutTypeClone () const
 Clone the SpatialDropoutType object. This handles polymorphism correctly. More...

 
void Forward (const InputType &input, OutputType &output)
 Ordinary feed forward pass of the SpatialDropout layer. More...

 
double Ratio () const
 Get the probability value. More...

 
void Ratio (const double r)
 Modify the probability value. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialize the layer. More...

 
size_t Size () const
 Get the number of channels. More...

 
size_t & Size ()
 Modify the number of channels. 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::SpatialDropoutType< InputType, OutputType >

Implementation of the SpatialDropout layer.

For more information, refer to the following paper,

@article{Tompson15,
author = {Jonathan Tompson, Ross Goroshin, Arjun Jain,
Yann LeCun, Christopher Bregler},
title = {Efficient Object Localization Using Convolutional Networks},
journal = {CoRR},
volume = {abs/1411.4280},
year = {2015},
url = {https://arxiv.org/abs/1411.4280},
eprint = {1411.4280},
}
Template Parameters
InputTypeThe type of the layer's inputs. The layer automatically cast inputs to this type (Default: arma::mat).
OutputTypeThe type of the computation which also causes the output to also be in this type. The type also allows the computation and weight type to differ from the input type (Default: arma::mat).

Definition at line 50 of file spatial_dropout.hpp.

Constructor & Destructor Documentation

◆ SpatialDropoutType() [1/2]

Create the SpatialDropout object.

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

◆ SpatialDropoutType() [2/2]

SpatialDropoutType ( const size_t  size,
const double  ratio = 0.5 
)

Create the SpatialDropout object using the specified parameters.

Parameters
sizeThe number of channels of each input image.
ratioThe probability of each channel getting dropped.

Member Function Documentation

◆ Backward()

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

Ordinary feed backward pass of the SpatialDropout layer.

Parameters
inputThe propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.

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

◆ Clone()

◆ Forward()

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

Ordinary feed forward pass of the SpatialDropout layer.

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

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

◆ Ratio() [1/2]

double Ratio ( ) const
inline

Get the probability value.

Definition at line 91 of file spatial_dropout.hpp.

◆ Ratio() [2/2]

void Ratio ( const double  r)
inline

Modify the probability value.

Definition at line 94 of file spatial_dropout.hpp.

References SpatialDropoutType< InputType, OutputType >::serialize().

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

Serialize the layer.

Referenced by SpatialDropoutType< InputType, OutputType >::Ratio().

◆ Size() [1/2]

size_t Size ( ) const
inline

Get the number of channels.

Definition at line 85 of file spatial_dropout.hpp.

◆ Size() [2/2]

size_t& Size ( )
inline

Modify the number of channels.

Definition at line 88 of file spatial_dropout.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/spatial_dropout.hpp