12#ifndef MLPACK_METHODS_ANN_LAYER_SPATIAL_DROPOUT_HPP
13#define MLPACK_METHODS_ANN_LAYER_SPATIAL_DROPOUT_HPP
45 typename InputDataType = arma::mat,
46 typename OutputDataType = arma::mat
68 void Forward(
const arma::Mat<eT>& input, arma::Mat<eT>& output);
79 const arma::Mat<eT>& gy,
88 OutputDataType
const&
Delta()
const {
return delta; }
90 OutputDataType&
Delta() {
return delta; }
93 size_t Size()
const {
return size; }
96 size_t&
Size() {
return size; }
104 double Ratio()
const {
return ratio; }
110 scale = 1.0 / (1.0 - ratio);
116 template<
typename Archive>
121 OutputDataType delta;
124 OutputDataType outputParameter;
155#include "spatial_dropout_impl.hpp"
Implementation of the SpatialDropout layer.
double Ratio() const
Get the probability value.
OutputDataType const & Delta() const
Get the delta.
SpatialDropout(const size_t size, const double ratio=0.5)
Create the SpatialDropout object using the specified parameters.
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Ordinary feed forward pass of the SpatialDropout layer.
size_t & Size()
Modify the number of channels.
OutputDataType const & OutputParameter() const
Get the output parameter.
size_t Size() const
Get the number of channels.
void Backward(const arma::Mat< eT > &input, const arma::Mat< eT > &gy, arma::Mat< eT > &g)
Ordinary feed backward pass of the SpatialDropout layer.
SpatialDropout()
Create the SpatialDropout object.
void Ratio(const double r)
Modify the probability value.
bool & Deterministic()
Modify the value of the deterministic parameter.
bool Deterministic() const
Get the value of the deterministic parameter.
OutputDataType & OutputParameter()
Modify the output parameter.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType & Delta()
Modify the delta.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.