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);
78 void Backward(
const arma::Mat<eT>& input,
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>
117 void serialize(Archive& ar,
const uint32_t );
121 OutputDataType delta;
124 OutputDataType outputParameter;
155 #include "spatial_dropout_impl.hpp" 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.
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Ordinary feed forward pass of the SpatialDropout layer.
void Backward(const arma::Mat< eT > &input, const arma::Mat< eT > &gy, arma::Mat< eT > &g)
Ordinary feed backward pass of the SpatialDropout layer.
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
void Ratio(const double r)
Modify the probability value.
double Ratio() const
Get the probability value.
size_t & Size()
Modify the number of channels.
SpatialDropout()
Create the SpatialDropout object.
OutputDataType const & Delta() const
Get the delta.
OutputDataType & OutputParameter()
Modify the output parameter.
size_t Size() const
Get the number of channels.
Implementation of the SpatialDropout layer.
OutputDataType const & OutputParameter() const
Get the output parameter.
bool Deterministic() const
Get the value of the deterministic parameter.
bool & Deterministic()
Modify the value of the deterministic parameter.